<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>三级联动-甘世涛2019131709</title>

<style>

select{
width: 60px;
margin: 5px;
font-size: 1px;
border-radius: 5px;
border:1px solid;
}

input.inputone{
margin: 5px;
width:250px;
font-size: 1px;
border:1px solid;
}
input.buttonone{
margin: 5px;
width:250px;
font-size: 1px;
background-color:darkgray;
color:white;
border-radius: 5px;
}


body{

font-size: 1px;

}
.boxone
{
width:260px;
background-color:darkgray;
border-radius: 5px;
margin: 10px;

}
.boxtwo
{
width:260px;
background-color:cornflowerblue;
border-radius: 5px;
margin: 1px;
color:white;
	
}
.boxzero
{

width:280px;
height:300px;
border-radius: 5px;
border:1px solid;
}
input.buttonone{
    margin: 5px;
    width:250px;
    font-size: 1px;
    background-color:darkgray;
    color:white;
    border-radius: 5px;
}

input.buttonone:focus
{
background-color:mediumslateblue;
}
input.buttonone:hover
{

background-color:red;

}

</style>


<script>




// 省份数组

var provincearrary = ['上海', '江苏', '河北','广东'];
// 城市数组
var cityarray = [
['上海市'],
['苏州市', '南京市', '扬州市'],
['石家庄', '秦皇岛', '张家口'],
['东莞市', '肇庆市', '广州市','梅州市']
];
// 区域数组
var countryarray = [
[
['黄浦区', '静安区', '长宁区', '浦东区']
],
[
['虎丘区', '吴中区', '相城区', '姑苏区', '吴江区'],
['玄武区', '秦淮区', '建邺区', '鼓楼区', '浦口区'],
['邗江区', '广陵区', '江都区']
],
[
['长安区', '桥西区', '新华区', '井陉矿区'],
['海港区', '山海关区', '北戴河区', '抚宁区'],
['桥东区', '桥西区', '宣化区', '下花园区']
],
[
['石排镇', '长安镇', '桥头镇', '虎门镇'],
['端州区', '鼎湖区', '高要区', '怀集县'],
['海珠区', '天河区', '白云区', '番禺区'],
['梅江区','梅县区','大埔县','丰顺县','五华县','平远县','蕉岭县','兴宁市']
]
];
window.onload = function(){
var province = document.getElementById('province');
var city = document.getElementById('city');
var country = document.getElementById('country');
createOption(province, provincearrary);
province.onchange = function(){
city.length = 0;
createOption(city, cityarray[this.selectedIndex]);
city.onchange();
}
city.onchange = function(){
country.length = 0;
createOption(country, countryarray[province.selectedIndex][this.selectedIndex]);

}
province.onchange();
}
function createOption(obj, data){
for (var i = 0; i < data.length; i++) {
var newOption = new Option(data[i], data[i]);
obj.add(newOption, null);

}
}
function information()
{
alert('软件工程7班第九组\n甘世涛:2019131709\n詹鹏志:2019131739\n陆伟北:2019131726\n卓俊炜:2019131727\n梁秋亭:2019131733');
}



function information1(o)
{
var flag=0;
var array=['收件人','联系电话','地址'];
var str='';
if(o.shoujianren.value=='')
{str+=array[0]+'\n';
flag=1;
}
if(o.dianhua.value=='')
{str+=array[1]+'\n';
flag=1;}
if(o.dizhi.value=='')
{str+=array[2]+'\n';
flag=1;}
if(flag==1)
alert("请输入以下信息：\n"+str);
else
alert("信息发送成功\n地址为："+o.select1.value+o.select2.value+o.select3.value+"\n收件人为："+o.shoujianren.value+"\n联系电话为："+o.dianhua.value+"\n详细地址为："+o.dizhi.value);

}

</script>
</head>
<body>
<br><br><br>
<center>
<div class="boxzero">
<div class="boxone">编辑收货地址</div>
<div class="boxtwo">甘世涛-2019131709</div>
<form name="login" onsubmit="javascript:return information1(this);">
<input type="text" name="shoujianren" class="inputone" style="border-top-width:0px;border-left-width:0px;border-right-width:0px;"placeholder="收件人"><br>
<input type="text" name="dianhua"class="inputone"    style="border-top-width:0px;border-left-width:0px;border-right-width:0px;"placeholder="联系电话"><br>
<input type="text" name="dizhi"class="inputone"        style="border-top-width:0px;border-left-width:0px;border-right-width:0px;"placeholder="详细地址"><br>
省:<select name="select1" id="province"></select>
市:<select name="select2" id="city"></select>
区:<select name="select3" id="country"></select><br>

<input type="submit"value="确认"class="buttonone"><br>
<input type="reset"value="取消"class="buttonone"><br>
<form>
</div>
</center>

</body>
</html>